Option Explicit
Sub F_Sample021()
    'Microsoft DAO 3.6 Object Library ]wޥζ
    'ոF_Data.mdb F_Tbl01
    Dim myDb       As DAO.Database
    Dim myRst      As DAO.Recordset
    Dim myFileName As String
    Dim myTblName  As String
    Dim myKey      As String
    Dim i          As Long
    Worksheets.Add
    myFileName = "F_Data.mdb"			'ŪJɮ
    myTblName = "F_Tbl01"        		'ŪJ
    Set myDb = OpenDatabase(ThisWorkbook.Path & "\" & myFileName)
    Set myRst = myDb.OpenRecordset(myTblName)
    With myRst
        'W
        For i = 1 To .Fields.Count
            Cells(1, i).Value = .Fields(i - 1).Name
        Next
        ']wjMί
        .Index = "PrimaryKey"
        'jMKEYJ
        myKey = InputBox("пJjMKEY-s:")
        'jMO_sn
        .Seek "=", myKey
        'nɪBz
        If .NoMatch Then
            MsgBox ("ӽsQn")
        Else
            'ܳBz
            Range("A2").CopyFromRecordset myRst, 1
        End If
    End With
    myRst.Close
    myDb.Close
    Set myRst = Nothing					'
    Set myDb = Nothing
End Sub
